﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GONES.IBLL;
using GONES.Tools.Common;

public partial class Console_UserRights_UserRightsList : CPage
{

    

    public string UserNameString;

    protected void Page_Load(object sender, EventArgs e)
    {
        BindData();
    }

    /// <summary>
    /// 数据绑定，同时需要设置数据总条数
    /// 当前页与每页条数由页面中的pagerForm回传得到
    /// </summary>
    private void BindData()
    {
        UserNameString = Request.Form["txtUserName"];
        var userInfoManager = AppContext.GetObject("S_UsersManager") as IS_UsersManager;
        IList<DataFilter> dataFilters = new List<DataFilter>();
        if (!string.IsNullOrEmpty(UserNameString))
        {
            DataFilter df = new DataFilter() { Type = "string", Value = UserNameString, Field = "UserName" };
            df.Comparison = "like";
            dataFilters.Add(df);
        }
        long recordCount = TotalCount;
        RepeaterTr.DataSource = userInfoManager.List(dataFilters, PageNum, NumPerPage, ref recordCount);
        RepeaterTr.DataBind();
        TotalCount = recordCount;
    }

    public string GetEmployeeName(string empid)
    {
        string empname = "";
        var empManager = AppContext.GetObject("S_EmployeesManager") as IS_EmployeesManager;
        GONES.Model.S_Employees emp = empManager.Get(empid);
        if (emp != null)
            empname= emp.EmployeeName;
        return empname;
    }
}